// view/index/jianguanxq/jianguanxq.js
let app = getApp()
let yuming = app.globalData.yuming
const recorderManager = wx.getRecorderManager()
const innerAudioContext = wx.createInnerAudioContext()
const request = require('../../config/request');
Page({
    ...request,
    /**
     * 页面的初始数据
     */
    data: {
        // fromtype=1  是温湿度
        yuming: yuming,
        heights: "",
        title: '',
        xqs: '',
        isreply: '',
        curr: '',
        huifu_id: '', //回复id
        isbo: false, //是否播放
        er: 0,
        isbo2: false,
        er2: 0,
        isshow: false,
        isyuyin: false,
        isSpeaking: false,
        miao: 1,
        wenben: '', //文本内容
        wuyuyin: '',
        isbo3: false,
        er3: 0,
        duration: '',
        bofangurl: [],
        up: 0,
        photo: [],
        wuphoto: [],
        isAppendix: '', //自查报告 1是 0否
        // fils: '', //url
        fujian: '',
        fujain_font: '', //name
        fujianarr:[],//记录多附件数据列表
        jinghe_id:''
    },
    // 上传附件   多附件上传
  gofujian() {
    let that = this
    that.setData({
      zong: ''
    })
    var ar = []
    ar = ['xlsx', 'xls', 'doc', 'docx', 'pdf', "jpg", "jpeg", "png"]
    wx.chooseMessageFile({
      count: 1,
      type: 'all',
      extension: ar,
      success(res){
          console.log(res)
          var tempFiles = res.tempFiles
          tempFiles.map(item=>{
              console.log(item)
              that.forfujian(item)
          })
      }
    })
  },
  forfujian(tempFile){
    let that = this
    var jsons = {}
    var file = tempFile.path
    var name = tempFile.name
    var s = file.indexOf(".")
    var b = file.substring(s + 1) //下划线之后
    console.log(b)
    if (b != 'doc' && b != 'docx' && b != 'xls' && b != 'xlsx' && b != 'pdf' && b != 'jpg' && b != 'jpeg' && b != 'png') {
      wx.showToast({
        title: '当前格式不能上传哦~',
        icon: 'none'
      })
    } else {
      wx.showLoading({
        title: '上传中',
      })
      that.setData({
        fujain_font: name
      })
      jsons.name = name
      wx.uploadFile({
        url: yuming + 'Besall/Upload', //仅为示例，非真实的接口地址
        filePath: file,
        name: 'file',
        formData: {
          file: file
        },
        success(res) {
          var data = JSON.parse(res.data)
          var ba = data.httpUrl + data.imgUrl
          var code2 = ba.split('.')[3];
          jsons.zong= data.httpUrl + data.imgUrl
          jsons.appendix_url= data.imgUrl
          that.setData({
            fujian:data.imgUrl
          })
          // if (code2 == 'pdf' || code2 == 'docx' || code2 == 'doc') {
          wx.downloadFile({
            url: data.httpUrl + data.imgUrl,
            success(res) {
              var filePath = res.tempFilePath
              jsons.fil= filePath
              
              var fujianarr =[...that.data.fujianarr,jsons] 
              that.setData({
                 fujianarr: fujianarr,
                fil: filePath,
                zong: filePath

              })
              wx.hideLoading({
                success: (res) => {},
              })
            }
          })
          // }

        }
      })
    }
  },
// 删除附件
delete(e){
  console.log(e)
  let index = e.currentTarget.dataset.index;
   var fujianarr = this.data.fujianarr
    fujianarr.splice(index,1)
   this.setData({
    fujianarr:fujianarr
   })
},
    gofujians() {
        let that = this
        that.setData({
            zong: ''
        })
        var ar = []
        ar = ['xlsx', 'xls', 'doc', 'docx', 'pdf', "jpg", "jpeg", "png"]
        wx.chooseMessageFile({
            count: 1,
            type: 'all',
            extension: ar,
            success(res) {
                var file = res.tempFiles[0].path
                var name = res.tempFiles[0].name
                var s = file.indexOf(".")
                var b = file.substring(s + 1) //下划线之后
                console.log(b)
                if (b != 'doc' && b != 'docx' && b != 'xls' && b != 'xlsx' && b != 'pdf' && b != 'jpg' && b != 'jpeg' && b != 'png') {
                    wx.showToast({
                        title: '当前格式不能上传哦~',
                        icon: 'none'
                    })
                } else {
                    wx.showLoading({
                        title: '上传中',
                    })
                    that.setData({
                        fujain_font: name
                    })
                    wx.uploadFile({
                        url: yuming + 'Besall/Upload', //仅为示例，非真实的接口地址
                        filePath: file,
                        name: 'file',
                        formData: {
                            file: file
                        },
                        success(res) {
                            var data = JSON.parse(res.data)
                            var ba = data.httpUrl + data.imgUrl
                            var code2 = ba.split('.')[3];
                            that.setData({
                                fujian: ba
                            })
                            // if (code2 == 'pdf' || code2 == 'docx') {
                            wx.downloadFile({
                                url: data.httpUrl + data.imgUrl,
                                success(res) {
                                    var filePath = res.tempFilePath
                                    that.setData({
                                        fils: filePath,
                                        zong: filePath
                                    })
                                    wx.hideLoading({
                                        success: (res) => {},
                                    })
                                }

                            })
                            // }

                        }
                    })
                }
            }
        })
    },
    gojian(e) {
        let url = e.currentTarget.dataset.fil
        var s = url.lastIndexOf(".")
        var b = url.substring(s + 1) //下划线之后
        console.log(2121)
        console.log(b)
        if (b == 'jpg' || b == 'jpeg' || b == 'png') {
            wx.previewImage({
                urls: [url]
            })
        } else {
            wx.showLoading({
                title: '正在打开中',
            })
            wx.downloadFile({
                url: url,
                success(res) {
                    console.log(res)
                    var filePath = res.tempFilePath
                    console.log(filePath)
                    wx.openDocument({
                        filePath: filePath,
                        fileType: b,
                        success: function (res) {
                            wx.hideLoading({
                                success: (res) => {},
                            })
                        },
                        fail(err) {
                            wx.hideLoading({
                                success: (res) => {},
                            })
                            wx.showToast({
                                title: '打开失败',
                                icon: 'none'
                            })
                        }
                    })


                }
            })

        }
    },
    // 差掉
    chadiao(e) {
        var index = e.currentTarget.dataset.index
        var photo = this.data.photo;
        var wuphoto = this.data.wuphoto;
        // var dd = wuphoto.toString()
        photo.splice(index, 1)
        wuphoto.splice(index, 1)
        // dd.splice(index, 1)
        // var rr = dd.join(",")
        this.setData({
            photo: photo,
            wuphoto: wuphoto
        })
    },
    // 上传
    chuan(e) {
        var that = this
        var pics = [];
        var wuphoto = this.data.wuphoto;
        this.myChooseImage(9).then(res => {
            const tempFilePaths = res.tempFilePaths
            for (var i = 0; i < tempFilePaths.length; i++) {
                pics.push(tempFilePaths[i])
            }
            if ((pics.length) + (that.data.photo.length) > 9) {
                wx.showToast({
                    title: '最多可上传' + 9 + "张",
                    icon: 'none'
                })
            } else {
                for (var i = 0; i < tempFilePaths.length; i++) {
                    (function (i) { // 注意这里是形参
                        setTimeout(function () {
                            that.duoupimg(tempFilePaths[i]).then(res => {
                                wx.showLoading({
                                    title: '上传图片中...',
                                });
                                var data = JSON.parse(res.data)
                                var urls = data.httpUrl + data.imgUrl
                                var wuurls = data.imgUrl
                                // wuphoto = wuphoto.concat(data.imgUrl + ",")
                                that.setData({
                                    photo: that.data.photo.concat(urls),
                                    wuphoto: that.data.wuphoto.concat(wuurls),
                                });
                                if (i == tempFilePaths.length - 1) {
                                    wx.hideLoading();
                                }
                            })
                        }, 800 * i); // 还是每秒执行一次，不是累加的
                    })(i) // 注意这里是实参，这里把要用的参数传进去
                }
            }
        })
    },
    bo(e) {
        var aaa = e.currentTarget.dataset.aaa
        console.log('开始播放')
        if (aaa == 0) {
            this.setData({
                isbo: !this.data.isbo
            })
        }
        if (aaa == 1) {
            this.setData({
                isbo2: !this.data.isbo2
            })
        }
        var that = this
        var t1 = setInterval(function () {
            if (aaa == 0) {
                var num = that.data.er
                console.log('监管')
            } else if (aaa == 1) {
                var num = that.data.er2
                console.log('我')
            }
            num++
            if (aaa == 0) {
                that.setData({
                    er: num
                })
                if (that.data.er > 2) {
                    that.setData({
                        er: 0
                    })
                }
            }
            if (aaa == 1) {
                that.setData({
                    er2: num
                })
                if (that.data.er2 > 2) {
                    that.setData({
                        er2: 0
                    })
                }
            }
        }, 300)
        let url = e.currentTarget.dataset.url[0]
        innerAudioContext.src = url
        console.log(innerAudioContext.src)
        innerAudioContext.play()
        innerAudioContext.obeyMuteSwitch = false
        innerAudioContext.onEnded(() => {
            console.log("停止播放")
            innerAudioContext.stop()
            clearInterval(t1);
            if (aaa == 0) {
                that.setData({
                    isbo: false,
                    er: 0
                })
            }
            if (aaa == 1) {
                that.setData({
                    isbo2: false,
                    er2: 0
                })
            }
        })

    },
    // 详情
    xq() {
        wx.showLoading({
            title: '加载中',
        })
        var that = this
        this.myRequest(yuming + 'Besall/NoticeForInfo', {
            shopId: wx.getStorageSync('shopId'),
            id: that.data.id
        }, "POST").then(res => {
            console.log(res)
            var data = res.data.data
            if (data.NoticeRead.appendix == null) {
                data.NoticeRead.appendix = ''
            }
            if (data.NoticeRead.appendixname == null) {
                data.NoticeRead.appendix = ''
            }
            // console.log(data.NoticeRead.appendixname)
            that.setData({
                xqs: res.data.data,
                isreply: res.data.data.isreply,
                isAppendix: res.data.data.isAppendix,
                fujian: data.NoticeRead.appendix,
                fujianarr: data.NoticeRead.appendix,
                fujain_font: data.NoticeRead.appendixname,
            })

            console.log(that.data.isreply)
            if (res.data.data.NoticeRead) {
                that.setData({
                    huifu_id: res.data.data.NoticeRead.id
                })
            }
        })
    },




    xqbaoji() {
      wx.showLoading({
          title: '加载中',
      })
      var that = this
      this.myRequest(yuming + 'Shopthat/shop_notice_info', {
          shopId: wx.getStorageSync('shopId'),
          id: that.data.id
      }, "POST").then(res => {
          console.log(res)
          var datas = res.data.data.Shopnotice
          // if (data.appendix == null) {
          //     data.appendix = ''
          // }
          // if (data.appendixname == null) {
          //     data.appendix = ''
          // }
          // console.log(data.NoticeRead.appendixname)

          let aaabbs = JSON.parse(datas.appendix)
          console.log(aaabbs);
          that.setData({
              xqs: datas,
              isreply: datas.isreply,
              isAppendix: datas.isAppendix,
              fujian: aaabbs,
              fujianarr: aaabbs,
              fujain_font: datas.appendixname,
          })

          console.log(that.data.isreply)
          if (res.data.data.NoticeRead) {
              that.setData({
                  huifu_id: res.data.data.NoticeRead.id
              })
          }
      })
  },
    // 手动输入
    kaiwen(e) {
        var id = e.currentTarget.dataset.id
        this.setData({
            isshow: !this.data.isshow,
            isyuyin: false,
            ids: id,
            isPhonetic: 0
        })
    },
    // 语音输入
    yuyinsr(e) {
        var id = e.currentTarget.dataset.id
        this.setData({
            isyuyin: !this.data.isyuyin,
            isshow: false,
            ids: id,
            isPhonetic: 1
        })
    },
    // 文本输入内容
    wenben(e) {
        this.setData({
            wenben: e.detail.value
        })
    },
    start(e) {
        this.setData({
            options: {
                duration: 60000, //录音的时长，单位 ms
                sampleRate: 44100, //采样率
                numberOfChannels: 1, //录音通道数
                encodeBitRate: 192000, //编码码率
                format: 'mp3', //音频格式
            }
        })
        console.log(this.data.options.duration)
        recorderManager.start(this.data.options)
        recorderManager.onStart(() => {
            console.log('录音开始')
        })
        var that = this
        this.data.setInter = setInterval(function () {
            var miaos = that.data.miao++
            // var sss = Math.floor(miaos / 1000 % 60);
            console.log(miaos)
            if (miaos == 60) {
                that.end()
            }
        }, 1000)
        this.setData({
            isSpeaking: true
        })
    },
    end: function (e) {
        var that = this;
        recorderManager.stop(); //先停止录音
        that.setData({
            miao: 1
        })
        clearInterval(this.data.setInter);
        this.setData({
            isSpeaking: false
        })
        recorderManager.onStop((res) => { //监听录音停止的事件
            console.log("监听录音停止事件", res)
            if (res.duration < 1000) {
                wx.showToast({
                    title: '录音时间太短',
                    icon: 'none'
                })
                return;
            } else {
                let time = res.duration
                var s = Math.floor(time / 1000 % 60);
                that.setData({
                    duration: s
                })
                var tempFilePath = res.tempFilePath; // 文件临时路径
                console.log("文件临时路径", tempFilePath)
                // var sub = {url:tempFilePath,miao:s}
                // that.setData({
                //   bofangurl:this.data.bofangurl.concat(sub)
                // })
                wx.uploadFile({
                    url: yuming + 'Besall/Upload', //上传服务器的地址
                    filePath: tempFilePath, //临时路径
                    name: 'file',
                    header: {
                        contentType: "multipart/form-data", //按需求增加
                    },
                    formData: null,
                    success: function (res) {
                        var data = JSON.parse(res.data)
                        that.setData({
                            bofangurl: data.httpUrl + data.imgUrl,
                            wuyuyin: data.imgUrl,
                        })
                    },
                    fail: function (err) {
                        console.log(err.errMsg);
                    }
                });
            }
        });
    },
    // 回复
    huifu(e) {
        var type = e.currentTarget.dataset.type
        if (type == 'wenben') {
            // if (this.data.isAppendix == 1) {
            //     if (this.data.fujian == '') {
            //         wx.showToast({
            //             title: '请上传附件',
            //             icon: 'none'
            //         })
            //     } else {
            //         if (this.data.wenben == '') {
            //             wx.showToast({
            //                 title: '请输入回复内容',
            //                 icon: 'none'
            //             })
            //         } else {
            //             this.jiek()
            //         }

            //     }
            // } 
            if (this.data.wenben == '') {
                wx.showToast({
                    title: '请输入回复内容',
                    icon: 'none'
                })
            } else {
                this.jiek()
            }
        }
        if (type == 'yuyin') {
            // if (this.data.isAppendix == 1) {
            //     if (this.data.fujian == '') {
            //         wx.showToast({
            //             title: '请上传附件',
            //             icon: 'none'
            //         })
            //     } else {
            //         if (this.data.bofangurl == '') {
            //             wx.showToast({
            //                 title: '还没有回复内容',
            //                 icon: 'none'
            //             })
            //         } else {
            //             this.jiek()

            //         }
            //     }
            // } 
            if (this.data.bofangurl == '') {
                wx.showToast({
                    title: '还没有回复内容',
                    icon: 'none'
                })
            } else {
                this.jiek()
            }
        }

    },
    // 温湿度回复
    wenshi_hui(e) {
        var type = e.currentTarget.dataset.type
        if (type == 'wenben') {
            if (this.data.wenben == '') {
                wx.showToast({
                    title: '请输入回复内容',
                    icon: 'none'
                })
            } else if (this.data.photo.length == 0) {
                wx.showToast({
                    title: '请上传图片',
                    icon: 'none'
                })
            } else {
                this.wenjie()
            }
        }
        if (type == 'yuyin') {
            if (this.data.bofangurl == '') {
                wx.showToast({
                    title: '还没有回复内容',
                    icon: 'none'
                })
            } else {
                this.wenjie()
            }
        }
    },
    wenjie() {
        var wuphoto = this.data.wuphoto.toString()
        var that = this
        this.myRequest(yuming + 'Besall/shop_humidity_huifu', {
            shopId: wx.getStorageSync('shopId'),
            id: that.data.huifu_id,
            fid: that.data.ids,
            reply: that.data.wenben,
            isPhonetic: that.data.isPhonetic,
            Phonetic: that.data.wuyuyin,
            seconds: that.data.duration,
            images: wuphoto,
        }, "POST").then(res => {
            wx.showToast({
                title: res.data.msg,
                icon: 'none'
            })
            if (res.data.code == 200) {
                setTimeout(function () {
                    that.xq()
                    that.setData({
                        isshow: false,
                        isyuyin: false,
                        wenben: '',
                        bofangurl: '',
                        photo: [],
                        wuphoto: [],
                    })
                }, 500)
            }

        })
    },
    jiek() {
        var that = this
        var fujianarrs = JSON.stringify(this.data.fujianarr)
        
        var data = {
          shopId: wx.getStorageSync('shopId'),
          id: that.data.huifu_id,
          fid: that.data.ids,
          reply: that.data.wenben,
          isPhonetic: that.data.isPhonetic,
          Phonetic: that.data.wuyuyin,
          seconds: that.data.duration,
          appendix: fujianarrs,
          appendixname: this.data.fujianarr.length>0?this.data.fujianarr[0].name:'',
        }
        console.log(data)
        // return false
        this.myRequest(yuming + 'Besall/NoticeForReplySave', data, "POST").then(res => {
            wx.showToast({
                title: res.data.msg,
                icon: 'none'
            })
            setTimeout(function () {
                that.xq()
                that.setData({
                    isshow: false,
                    isyuyin: false,
                    wenben: '',
                    bofangurl: ''
                })
            }, 500)
        })
    },
    dingyue() {
        var huifu_id = this.data.huifu_id
        var ids = this.data.ids
        var wenben = this.data.wenben
        var isPhonetic = this.data.isPhonetic
        var wuyuyin = this.data.wuyuyin
        var duration = this.data.duration
        var that = this
        if (!wx.getStorageSync('token')) {
            wx.showModal({
                title: '订阅监管消息需要授权哦~',
                cancelText: '取消',
                confirmText: '前往',
                success: function (res) {
                    if (res.confirm) {
                        console.log("确定")
                        wx.navigateTo({
                            url: '/page_zhu/shou/shou?sta=66',
                        })
                    } else {
                        that.jiek()
                    }
                }
            })
        } else {
            if (wx.getStorageSync('is_ding') == 0) {
                wx.showModal({
                    title: '提示',
                    content: '请授权开通服务通知',
                    showCancel: true,
                    success: function (ress) {
                        if (ress.confirm) {
                            wx.requestSubscribeMessage({ // 调起消息订阅界面
                                tmplIds: ['KSHQML6UP1xlkYCX0_BGtPdr5n_1sqEzypaL_bdwgkA', 'f5VhPUbj51dhls-w-ruVnM5mkZ7HfZ2zqaUps-1tolY', 'f5VhPUbj51dhls-w-ruVnKKomc7IFXExpjFCKrrJwsQ', 'tKyckTTaIqCaJpRAqgrjmyk0CcNwney27x5U-je8VRs'],
                                success(res) {
                                    if (res.KSHQML6UP1xlkYCX0_BGtPdr5n_1sqEzypaL_bdwgkA === "accept") {
                                        console.log(res);
                                        wx.request({
                                            url: yuming + 'Besall/subscribe_save',
                                            method: 'POST',
                                            header: {
                                                "content-type": "application/x-www-form-urlencoded",
                                                token: wx.getStorageSync('token'),
                                            },
                                            data: {

                                            },
                                            success: function (res) {
                                                console.log(res)
                                                if (res.data.code == 200) {
                                                    wx.setStorageSync('is_ding', 1)
                                                    wx.request({
                                                        url: yuming + 'Besall/NoticeForReplySave',
                                                        method: 'POST',
                                                        header: {
                                                            "content-type": "application/x-www-form-urlencoded",
                                                            token: wx.getStorageSync('token'),
                                                        },
                                                        data: {
                                                            shopId: wx.getStorageSync('shopId'),
                                                            id: huifu_id,
                                                            fid: ids,
                                                            reply: wenben,
                                                            isPhonetic: isPhonetic,
                                                            Phonetic: wuyuyin,
                                                            seconds: duration
                                                        },
                                                        success: function (res) {
                                                            wx.showToast({
                                                                title: res.data.msg,
                                                                icon: 'none'
                                                            })
                                                            setTimeout(function () {
                                                                wx.navigateBack({
                                                                    delta: 0,
                                                                })
                                                            }, 500)
                                                        },
                                                        fail: function () {
                                                            console.log("请求数据失败");
                                                        }
                                                    })



                                                } else {
                                                    wx.setStorageSync('is_ding', 0)
                                                }
                                            },
                                            fail: function () {
                                                console.log("请求数据失败");
                                            }
                                        })
                                    }


                                },
                                fail(er) {
                                    console.log("订阅消息 失败 ");
                                    console.log(er);
                                    that.jiek()
                                    wx.setStorageSync('is_ding', 0)
                                }
                            })

                        } else {
                            that.jiek()
                        }
                    }
                })
            } else {
                that.jiek()
            }

        }
    },
    bo(e) {
        var aaa = e.currentTarget.dataset.aaa
        console.log('开始播放')
        if (aaa == 0) {
            this.setData({
                isbo: !this.data.isbo
            })
        }
        if (aaa == 1) {
            this.setData({
                isbo2: !this.data.isbo2
            })
        }
        if (aaa == 2) {
            this.setData({
                isbo3: !this.data.isbo3
            })
        }
        var that = this
        var t1 = setInterval(function () {
            if (aaa == 0) {
                var num = that.data.er
                // console.log('监管')
            }
            if (aaa == 1) {
                var num = that.data.er2
                // console.log('我')
            }
            if (aaa == 2) {
                var num = that.data.er3
                // console.log('我')
            }
            num++
            if (aaa == 0) {
                that.setData({
                    er: num
                })
                if (that.data.er > 2) {
                    that.setData({
                        er: 0
                    })
                }
            }
            if (aaa == 1) {
                that.setData({
                    er2: num
                })
                if (that.data.er2 > 2) {
                    that.setData({
                        er2: 0
                    })
                }
            }
            if (aaa == 2) {
                that.setData({
                    er3: num
                })
                if (that.data.er2 > 2) {
                    that.setData({
                        er3: 0
                    })
                }
            }
        }, 300)
        var url = ''
        if (aaa == 1) {
            console.log(yuming + e.currentTarget.dataset.url)
            url = yuming + e.currentTarget.dataset.url
        } else {
            url = e.currentTarget.dataset.url
        }
        innerAudioContext.src = url
        console.log(innerAudioContext.src)
        innerAudioContext.play()
        innerAudioContext.obeyMuteSwitch = false
        innerAudioContext.onEnded(() => {
            console.log("停止播放")
            innerAudioContext.stop()
            clearInterval(t1);
            if (aaa == 0) {
                that.setData({
                    isbo: false,
                    er: 0
                })
            }
            if (aaa == 1) {
                that.setData({
                    isbo2: false,
                    er2: 0
                })
            }
            if (aaa == 2) {
                that.setData({
                    isbo3: false,
                    er3: 0
                })
            }
        })
    },
    openfujian(e) {
        this.downloadFile(e)
    },
    downloadFile: function (e) {
        let that = this;
        let url = e.currentTarget.dataset.url
        let type = e.currentTarget.dataset.name.split('.')[1];
        console.log(type)
        var s = url.lastIndexOf(".")
        var b = url.substring(s + 1) //下划线之后
        console.log(b)
        if (b == 'jpg' || b == 'jpeg' || b == 'png') {
            wx.previewImage({
                urls: [url]
            })
        } else {
            wx.showLoading({
                title: '打开中',
            })
            wx.downloadFile({
                url: url,
                header: {},
                success: function (res) {
                    var filePath = res.tempFilePath;
                    console.log(filePath);
                    wx.openDocument({
                        filePath: filePath,
                        fileType: b,
                        showMenu: true,
                        success: function (res) {
                            wx.hideLoading({
                                success: (res) => {},
                            })
                        },
                        fail: function (res) {
                            wx.hideLoading({
                                success: (res) => {},
                            })
                        },
                        complete: function (res) {}
                    })
                },
                fail: function (res) {
                    wx.showToast({
                        title: '附件异常，无法打开',
                        icon: 'none'
                    })
                },
                complete: function (res) {},
            })
        }

    },
    // 放大
    fangda(e) {
        var img = e.currentTarget.dataset.src
        wx.previewImage({
            urls: [img]
        })
    },
    duofan(e) {
        var img = e.currentTarget.dataset.img
        var list = e.currentTarget.dataset.list
        var arr = []
        for (let i in list) {
            arr.push(list[i]); //属性
        }
        wx.previewImage({
            current: img,
            urls: arr
        })
    },
    quxiao() {
        this.setData({
            isshow: false,
            isyuyin: false,
            wenben: '',
            photo: [],
            wuphoto: [],
            up: 0
        })
    },
    inputFocus(e) {
        let that = this;
        console.log(e, '键盘弹起');
        if (e.detail.height) {
            that.setData({
                up: e.detail.height
            })
        }
    },
    changeInputBlur() {
        this.setData({
            up: 0
        })
    },
    backs() {
        wx.navigateBack({
            delta: 0
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.setData({
            heights: wx.getMenuButtonBoundingClientRect().top + 5,
            id: options.id,
            curr: options.curr,
            title: options.title,
            jinghe_id:wx.getStorageSync('jinghe_id')
        })
        if(wx.getStorageSync('jinghe_id')== 176){
          this.xq()
        }else{
          this.xqbaoji()
        }
        // var that = this
        // setTimeout(function () {
        //     that.xq()
        // }, 100)
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {},

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },
})